<?php require_once('Connections/sqlaerosnemanje.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>AeroPHPXML :: Brisanje GK tock</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>

<body>
<?php
mysql_select_db("aerosnemanje", $sqlaerosnemanje);
$idproj=$_GET['idprojekta'];
$gkpid=$_GET['gkpid'];
$imeproj_query = "SELECT * FROM projekti WHERE IDP=$idproj";
$imeproj_result = mysql_query($imeproj_query, $sqlaerosnemanje) or die(mysql_error());
$row_imeproj = mysql_fetch_assoc($imeproj_result);
$imeproj = $row_imeproj['Naziv'];

if($gkpid == 1)
{
	$delGK_query = "DELETE FROM tocke_grid WHERE IDProjekta='$idproj'";
	mysql_query($delGK_query);
	$delGKresult_query = "DELETE FROM tocke_grid_result WHERE IDProjekta='$idproj'";
	mysql_query($delGKresult_query);
	$delWG_query = "DELETE FROM tocke_geodetic WHERE IDProjekta='$idproj'";
	mysql_query($delWG_query);
	$delProj_query = "DELETE FROM projekti WHERE IDP='$idproj'";
	mysql_query($delProj_query);
	$delXMLparam_query = "DELETE FROM xml_parameters WHERE IDProjekta='$idproj'";
	mysql_query($delXMLparam_query);
	echo "Tocke Izbrisane. <a href=\"prikazi_projekte.php\">Nazaj na projekte</a>";
}
else {
  echo "<div align=center>Si preprican, da zelis izbrisati projekt <b>".$imeproj."</b>?<br>
  <a href=\"brisi_projekt.php?idprojekta=$idproj&gkpid=1\">Da, izbrisi!</a><br>
  <br>
  <a href=\"prikazi_projekte.php\"><< Preklic</a></div>";
}
?>
</body>
</html>
